﻿<UserControl x:Class="RStein.PosterousReader.WP.Views.PostAddEditView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:controlex="clr-namespace:RStein.PosterousReader.WP.UI"
    xmlns:behaviors="clr-namespace:RStein.PosterousReader.WP.Behaviors"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">

        <controlex:ProgressBarEx AttachedContent="{Binding ElementName=mainContent}" IsIndeterminate="{Binding IsSavePostInProgress}" IsVisible="{Binding IsSavePostInProgress}" />
        <Grid Name="mainContent">
            <Grid.RowDefinitions>
                <RowDefinition Height="1.5*"/>
                <RowDefinition Height="5*"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <TextBox Grid.Row="0" Text="{Binding CurrentPost.Title, Mode=TwoWay}" behaviors:TextboxPasswordAttachedProperties.TextBoxChangedAction= "{Binding TextChangedAction}" TextWrapping="Wrap">
                <i:Interaction.Behaviors>
                    <behaviors:TextBoxTextChangedUpdateSourceBehavior/>
                </i:Interaction.Behaviors>
            </TextBox>
            
            <TextBox Grid.Row="1" Text="{Binding CurrentPost.Body, Mode=TwoWay}" behaviors:TextboxPasswordAttachedProperties.TextBoxChangedAction= "{Binding TextChangedAction}" TextWrapping="Wrap">
                
                <i:Interaction.Behaviors>
                    <behaviors:TextBoxTextChangedUpdateSourceBehavior/>
                </i:Interaction.Behaviors>
            </TextBox>
            
            <controlex:ButtonEx Grid.Row="2" Content="Uložit změny" Command="{Binding SaveCommand}" IsEnabled="{Binding SaveCommand.CanExecuteCommand}"></controlex:ButtonEx>
        </Grid>
    </Grid>
</UserControl>
